
package com.starshineworks.util.actions;

import com.starshineworks.util.*;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ActionCreateField extends Action {   
       
    @Override
    public boolean perform(HttpServletRequest  request, 
                           HttpServletResponse resp,
                           HttpServlet         serv, 
                           boolean             isMultiPart) 
    {      
        String next = "Admin";
        if (!isMultiPart) {
            return false;
        }
        try {
            if (!(new FileUploader(serv, request)).importFromServlet("FieldE")) {
                next = "Error?error=ERROR UPLOADING FILE";
                return false;
            }
        }
        catch (Exception e) {
            Util.handleException(e);
            return false;
        }
        return true;
    }
    
    @Override
    public String getNextPage() {
        return "Admin";
    }
    
    @Override
    public String getError() {
        return "Unable to import field list from file.";
    }

}
